//
//  CompanyApplicationUnSuccess.m
//  jingjing2.0
//
//  Created by apple on 16/5/24.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "CompanyApplicationUnSuccess.h"
#import "WriteApplicationViewController.h"
#define  WIDTH [UIScreen mainScreen].bounds.size.width
@implementation CompanyApplicationUnSuccess
-(id)initWithFrame:(CGRect)frame
{
    if (self=[super initWithFrame:frame]) {
             self.backgroundColor=LIGHTGRAY;
            for (int i=0; i<3; i++) {
            UILabel *lbl=[[UILabel alloc]initWithFrame:CGRectMake(10, i*(30+5)+30, WIDTH-20, 30)];
            lbl.textColor=[UIColor darkGrayColor];
            lbl.font=[UIFont systemFontOfSize:15];
            lbl.textAlignment=NSTextAlignmentCenter;
            if (i==0) {
                lbl.text=@"很抱歉，申请并未通过！";
                lbl.textColor=[UIColor redColor];
                lbl.font=[UIFont systemFontOfSize:20];
            } else if(i==1)
            {
                lbl.text=@"您可以拨打净净服务热线了解更多详情";
            }else
            {
                lbl.text=@"4000-123-299";
                lbl.textColor=BLUECOLOR;
                lbl.font=[UIFont systemFontOfSize:20];
                _rect=lbl.frame;
            }
            [self addSubview:lbl];
        }
        UIImageView *phone=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"custom_service"]];
        phone.frame=CGRectMake(_rect.origin.x+30, _rect.origin.y, 30, 30);
        [self addSubview:phone];
        
        UIButton *btn=[[UIButton alloc]initWithFrame:CGRectMake(10, frame.size.height-10-40, WIDTH-20, 40)];
        [btn setTitle:@"返回首页" forState:UIControlStateNormal];
        [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        btn.layer.cornerRadius=4;
        btn.clipsToBounds=YES;
        [btn addTarget:self action:@selector(backToHomeView) forControlEvents:UIControlEventTouchUpInside];
        btn.backgroundColor=BLUECOLOR;
        [self addSubview:btn];
        
        UIButton *share=[[UIButton alloc]initWithFrame:CGRectMake(10, frame.size.height-10-40-10-40, WIDTH-20, 40)];
        [share setTitle:@"重新申请" forState:UIControlStateNormal];
        [share setTitleColor:BLUECOLOR forState:UIControlStateNormal];
        share.layer.cornerRadius=4;
        share.clipsToBounds=YES;
        share.layer.borderWidth=1;
        share.layer.borderColor=BLUECOLOR.CGColor;
        [share addTarget:self action:@selector(applicationAgain) forControlEvents:UIControlEventTouchUpInside];
        share.backgroundColor=[UIColor whiteColor];
        [self addSubview:share];
        
    }
    return self;
}
-(void)applicationAgain
{
    
    [_delegate applicationAgain];
}
-(void)backToHomeView
{
    [_delegate backToHomeView];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
